/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.oi.eksekutif.ui.model;

import com.oi.eksekutif.domain.MerkMobil;
import java.text.SimpleDateFormat;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author jasoet
 */
public class MerkMobilTableModel extends AbstractTableModel {

    private List<MerkMobil> data;

    public MerkMobilTableModel(List<MerkMobil> data) {
        this.data = data;
    }

    @Override
    public int getRowCount() {
        return this.data.size();
    }

    @Override
    public int getColumnCount() {
        return 3;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        MerkMobil o = data.get(rowIndex);
        switch (columnIndex) {
            case 0:
                return o.getId();
            case 1:
                return o.getPabrikan();
            case 2:
                return o.getSeri();
            default:
                return "Invalid";
        }
    }

    @Override
    public String getColumnName(int column) {

        switch (column) {
            case 0:
                return "Id";
            case 1:
                return "Pabrikan";
            case 2:
                return "Seri";
            default:
                return "Invalid";
        }

    }
}
